#version 430 core
layout(triangles) in;
layout(triangle_strip, max_vertices=18) out;

uniform mat4 u_ShadowMatrices[6];

out vec4 g2f_FragPos;

void main()
{
	for(int face = 0; face < 6; face++)
	{
		gl_Layer = face; // built-in variable that specifies to which face we render.
		for(int i = 0; i < 3; i++)
		{
			g2f_FragPos = gl_in[i].gl_Position;
			gl_Position = u_ShadowMatrices[face] * g2f_FragPos;
			EmitVertex();
		}
		EndPrimitive();
	}
}